#ifndef _POCKET_EXTRACTOR_H
#define _POCKET_EXTRACTOR_H

#include <QVector>

#include "../math/Vector3.h"
#include "../data/geometrydata.h"
#include "../data/reg3dvolumedata.h"
#include "../data/proteindata.h"

class QProgressBar;

namespace PBVP {
	/// 
	class PocketExtractor 
	{
	public:
		/// 
		PocketExtractor(float dist = 40.f, float isoval = 1.5f, int filter_times = 1);

		/// 
		~PocketExtractor();

		/// Compute pocket volume from Geometry data
		Reg3DVolumeData* computePocketVolume(GeometryData *pGeoData);
		/// Compute pocket volume from a set of atoms
		Reg3DVolumeData* computePocketVolume(const QVector<Atom>& atoms);

		/// Compute pocket surface for Geometry data
		/** 
		 * Pocket surface is extracted as isosurface from the pocket volume
		 */
		GeometryData* computePocketSurface(GeometryData *pGeoData);
		/// 
		GeometryData* computePocketSurface(const QVector<Atom>& atoms);

		/// 
		void setProgressBar(QProgressBar *bar) {
			progressBar = bar;
		}

	private:
		Vector3 m_MinExt, m_MaxExt;
		float m_MarchingDistance;
		float m_IsoValue;
		int m_FilterTimes;

		void computeExtent(GeometryData *pGeoData);
		void computeExtent(const QVector<Atom>& atoms);

		void setProgress(int prog);

		QProgressBar *progressBar;
	};
}

#endif